#ifndef GLOBALLOGGER_H_INCLUDED
#define GLOBALLOGGER_H_INCLUDED

//predecl
class SubSystemManager;

//includes
#include <string>
#include "../General/cvString.h"
#include <SubSystemBase/SubSystemManager.h>

/// Following defines are used to enable/disable globallogger message levels AT COMPILETIME.
// CV_LOG_DEBUG	- show vast debugging information
// CV_LOG_INFO	- show info messages
// CV_LOG_WARN	- show warings
// CV_LOG_ERROR	- show error messages.
// CV_LOG_CRITICAL	- show information just after critical error.

// LOGDEBUG("MESSAGE");
#ifdef CV_LOG_DEBUG
#define LOGDEBUG(X) do { ::SubSystemManager::getInstance()->getLogger()->debug(\
						std::string(X) + "\n--->" + std::string(__FILE__) + "--->at line:" + stringify(__LINE__) ); } while(0)
#else
#define LOGDEBUG(X) do {} while(0)
#endif

// LOGINFO("MESSAGE");
#ifdef CV_LOG_INFO
#define LOGINFO(X) do { ::SubSystemManager::getInstance()->getLogger()->info((X)); } while(0)
#else
#define LOGINFO(X) do {} while(0)
#endif

// LOGWARN("MESSAGE");
#ifdef CV_LOG_WARN
#define LOGWARN(X) do { ::SubSystemManager::getInstance()->getLogger()->warn((X)); } while(0)
#else
#define LOGWARN(X) do {} while(0)
#endif

// LOGERROR("MESSAGE");
#ifdef CV_LOG_ERROR
#define LOGERROR(X) do { ::SubSystemManager::getInstance()->getLogger()->error((X)); } while(0)
#else
#define LOGERROR(X) do {} while(0)
#endif

// LOGCRITICAL("MESSAGE");
#ifdef CV_LOG_CRITICAL
#define LOGCRITICAL(X) do { ::SubSystemManager::getInstance()->getLogger()->critical(\
							std::string(X) + "\n--->" + std::string(__FILE__) + "--->at line:" + stringify(__LINE__)); } while(0)
#else
#define LOGCRITICAL(X) do {} while(0)
#endif

#endif // GLOBALLOGGER_H_INCLUDED
